package com.rent.business.controller;

import com.github.pagehelper.PageInfo;
import com.rent.business.model.CmsHelpCategory;
import com.rent.business.service.ICmsHelpCategoryService;
import com.rent.common.pojo.ResultJSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 帮助分类表 前端控制器
 * </p>
 *
 * @author zn
 * @since 2025-03-04
 */
@RestController
@RequestMapping("/cms/help/category")
@Api(value = "CmsHelpCategoryController", tags = "帮助分类相关接口")
public class CmsHelpCategoryController extends MyBaseController<ICmsHelpCategoryService, CmsHelpCategory, Integer> {

    // 前端调用的接口
    @RequestMapping(value = "/frontend/page/list", method = RequestMethod.POST)
    @ApiOperation(value = "获取帮助分类分页列表", notes = "前端获取帮助分类分页列表", tags = {"前端接口"})
    public ResultJSON<PageInfo<CmsHelpCategory>> getUserForFrontend(@ApiParam(value = "页码") @RequestParam(defaultValue = "1") Integer page,
                                                                    @ApiParam(value = "页数") @RequestParam(defaultValue = "10") Integer size,
                                                                    @RequestBody(required = false) CmsHelpCategory model) {
        return super.pageList(page, size, model);
    }

    // 后端调用的接口
    @RequestMapping(value = "/backend/page/list", method = RequestMethod.POST)
    @ApiOperation(value = "获取帮助分类分页列表", notes = "后端获取帮助分类分页列表", tags = {"后台接口"})
    public ResultJSON<PageInfo<CmsHelpCategory>> getUserForBackend(@ApiParam(value = "页码") @RequestParam(defaultValue = "1") Integer page,
                                                                   @ApiParam(value = "页数") @RequestParam(defaultValue = "10") Integer size,
                                                                   @RequestBody(required = false) CmsHelpCategory model) {
        return super.pageList(page, size, model);
    }

    @ApiOperation(value = "获取数据", notes = "获取数据")
    @RequestMapping(value = "/get", method = RequestMethod.GET)
    @Override
    public ResultJSON<CmsHelpCategory> getByKey(@ApiParam(value = "ID") @RequestParam(value = "id") Integer id) {
        return super.getByKey(id);
    }
}
